package com.pybox.api;


import com.pybox.dto.Result;
import com.pybox.dto.TExportExcelDto;
import com.pybox.service.TExportExceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author LeiYang
 * @title: TExportExcel
 * @projectName pybox
 * @description: 报表导出管理模块。
 * @date 2019/7/1515:16
 */

@Slf4j
@RequestMapping("/TExportExcel")
@Api(tags = "TExportExcel管理接口")
@RestController
//@CrossOrigin
public class TExportExcelApi {

    @Autowired
    private TExportExceService exportExceService;

    @ApiOperation(value = "分页查询钥匙库存数据")
    @RequestMapping(value = "/search", method = RequestMethod.GET)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "objName", value = "objName", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "status", value = "status", dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "pageNo", value = "pageNo", dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "pageSize", dataType = "int", paramType = "query")
    })
    public Result<Page<TExportExcelDto>> pageQuery(
            @RequestParam(required = false) String objName,
            @RequestParam(required = false) String status,
            @RequestParam Integer pageNo,
            @RequestParam Integer pageSize) {

        Map<String, String> params = new HashMap<>();

        params.put("objName", objName);
        params.put("status", status);
        return Result.ok(exportExceService.page(pageNo,pageSize,params));

    }
}
